<template>
    <div class="dashboard-container">
        <PanelGroup />
        <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;justify-content: center;">
            <LineCharts title="用户活跃度" :xdata="chartData?.mothDayText" :seriesdata="chartData?.mothDayUserActionValue" />
        </el-row>
        <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;justify-content: center;">
            <LineCharts title="题目月数量" :xdata="chartData?.mothDayText"
                :seriesdata="chartData?.mothDayDoExamQuestionValue" />
        </el-row>
    </div>
</template>

<script setup lang="ts">
import PanelGroup from './components/PanelGroup.vue';
import LineCharts from './components/LineCharts.vue';
import { dashboardIndex, type DashboardIndexResType } from '@/api/dashboard';
import { onMounted, ref } from 'vue';

const chartData = ref<DashboardIndexResType>()

function getData() {
    dashboardIndex().then(res => {
        // console.log(res.response);
        chartData.value = res.response
        // console.log(chartData.value);
    })
}

onMounted(() => {
    getData()
})
</script>
